import React, { useRef, useState } from 'react';
interface AaaProps {
    name: string;
    content: React.ReactElement
    age: React.ReactNode
}

const Aaa: React.FunctionComponent<AaaProps> = (props) => {
    // useRef的类型 dom引用必须传初始值是null，dom引用不得更改
    const divRef = useRef<HTMLDivElement>(null)
    // 保存值，也需要初始值
    const numRef = useRef<{num: number}>({num: 0})
    numRef.current = {num: 1}
    return <div ref={divRef}>aaa, {props.name}</div>
}

function App() {
    // useState的类型
    const num = useState<number>(1)

    return <div>
        <Aaa name="guang" content={<div>123</div>} age={null}></Aaa>
    </div>
}

export default App;